/**
 * @param {number} n - a positive integer
 * @return {number}
 */
var hammingWeight = function(n) {
    let bit = n.toString(2);
    let arr = Array.prototype.filter.call(bit,v=>v==='1');
    //console.log(bit,arr);
    return arr.length;
};

console.log(hammingWeight(11));